<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>lwIP: src/core/udp.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">lwIP
   &#160;<span id="projectnumber">2.1.2</span>
   </div>
   <div id="projectbrief">Lightweight IP stack</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('udp_8c.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">udp.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &quot;<a class="el" href="opt_8h.html">lwip/opt.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="udp_8h.html">lwip/udp.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="def_8h.html">lwip/def.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="memp_8h.html">lwip/memp.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="inet__chksum_8h.html">lwip/inet_chksum.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="ip__addr_8h.html">lwip/ip_addr.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="ip6_8h.html">lwip/ip6.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="ip6__addr_8h.html">lwip/ip6_addr.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="netif_8h.html">lwip/netif.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="icmp_8h.html">lwip/icmp.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="icmp6_8h.html">lwip/icmp6.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="stats_8h.html">lwip/stats.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="snmp_8h.html">lwip/snmp.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="dhcp_8h.html">lwip/dhcp.h</a>&quot;</code><br />
<code>#include &lt;string.h&gt;</code><br />
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ae7f7431ce99333577d7b82b26619309e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="udp_8c.html#ae7f7431ce99333577d7b82b26619309e">udp_init</a> (void)</td></tr>
<tr class="separator:ae7f7431ce99333577d7b82b26619309e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7b338a5515606bd51976fbc5bcec9611"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="udp_8c.html#a7b338a5515606bd51976fbc5bcec9611">udp_input</a> (struct <a class="el" href="structpbuf.html">pbuf</a> *p, struct <a class="el" href="structnetif.html">netif</a> *inp)</td></tr>
<tr class="separator:a7b338a5515606bd51976fbc5bcec9611"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa4546c43981f043c0ae4514d625cc3fc"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__infrastructure__errors.html#gaf02d9da80fd66b4f986d2c53d7231ddb">err_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__udp__raw.html#gaa4546c43981f043c0ae4514d625cc3fc">udp_send</a> (struct <a class="el" href="structudp__pcb.html">udp_pcb</a> *pcb, struct <a class="el" href="structpbuf.html">pbuf</a> *p)</td></tr>
<tr class="separator:gaa4546c43981f043c0ae4514d625cc3fc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa0e135a5958f1f0cc83cbeb609e18743"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__infrastructure__errors.html#gaf02d9da80fd66b4f986d2c53d7231ddb">err_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__udp__raw.html#gaa0e135a5958f1f0cc83cbeb609e18743">udp_sendto</a> (struct <a class="el" href="structudp__pcb.html">udp_pcb</a> *pcb, struct <a class="el" href="structpbuf.html">pbuf</a> *p, const <a class="el" href="group__ipaddr.html#ga16ef96d6cde029029bbf47fee35fd67a">ip_addr_t</a> *dst_ip, u16_t dst_port)</td></tr>
<tr class="separator:gaa0e135a5958f1f0cc83cbeb609e18743"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga83f8c873671ca7f307d14b29a0a7a142"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__infrastructure__errors.html#gaf02d9da80fd66b4f986d2c53d7231ddb">err_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__udp__raw.html#ga83f8c873671ca7f307d14b29a0a7a142">udp_sendto_if</a> (struct <a class="el" href="structudp__pcb.html">udp_pcb</a> *pcb, struct <a class="el" href="structpbuf.html">pbuf</a> *p, const <a class="el" href="group__ipaddr.html#ga16ef96d6cde029029bbf47fee35fd67a">ip_addr_t</a> *dst_ip, u16_t dst_port, struct <a class="el" href="structnetif.html">netif</a> *<a class="el" href="structnetif.html">netif</a>)</td></tr>
<tr class="separator:ga83f8c873671ca7f307d14b29a0a7a142"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa389827c979c766c1dae301239f7bbb7"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__infrastructure__errors.html#gaf02d9da80fd66b4f986d2c53d7231ddb">err_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__udp__raw.html#gaa389827c979c766c1dae301239f7bbb7">udp_sendto_if_src</a> (struct <a class="el" href="structudp__pcb.html">udp_pcb</a> *pcb, struct <a class="el" href="structpbuf.html">pbuf</a> *p, const <a class="el" href="group__ipaddr.html#ga16ef96d6cde029029bbf47fee35fd67a">ip_addr_t</a> *dst_ip, u16_t dst_port, struct <a class="el" href="structnetif.html">netif</a> *<a class="el" href="structnetif.html">netif</a>, const <a class="el" href="group__ipaddr.html#ga16ef96d6cde029029bbf47fee35fd67a">ip_addr_t</a> *src_ip)</td></tr>
<tr class="separator:gaa389827c979c766c1dae301239f7bbb7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac7fbda8b12b9b9360e92b51e805e799e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__infrastructure__errors.html#gaf02d9da80fd66b4f986d2c53d7231ddb">err_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__udp__raw.html#gac7fbda8b12b9b9360e92b51e805e799e">udp_bind</a> (struct <a class="el" href="structudp__pcb.html">udp_pcb</a> *pcb, const <a class="el" href="group__ipaddr.html#ga16ef96d6cde029029bbf47fee35fd67a">ip_addr_t</a> *ipaddr, u16_t port)</td></tr>
<tr class="separator:gac7fbda8b12b9b9360e92b51e805e799e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga4360535ae72e77019721c9637a1051a8"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__udp__raw.html#ga4360535ae72e77019721c9637a1051a8">udp_bind_netif</a> (struct <a class="el" href="structudp__pcb.html">udp_pcb</a> *pcb, const struct <a class="el" href="structnetif.html">netif</a> *<a class="el" href="structnetif.html">netif</a>)</td></tr>
<tr class="separator:ga4360535ae72e77019721c9637a1051a8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga83625967670477aa254643129a53971b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__infrastructure__errors.html#gaf02d9da80fd66b4f986d2c53d7231ddb">err_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__udp__raw.html#ga83625967670477aa254643129a53971b">udp_connect</a> (struct <a class="el" href="structudp__pcb.html">udp_pcb</a> *pcb, const <a class="el" href="group__ipaddr.html#ga16ef96d6cde029029bbf47fee35fd67a">ip_addr_t</a> *ipaddr, u16_t port)</td></tr>
<tr class="separator:ga83625967670477aa254643129a53971b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga8d26559743e59e4b409c92a268ee67fc"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__udp__raw.html#ga8d26559743e59e4b409c92a268ee67fc">udp_disconnect</a> (struct <a class="el" href="structudp__pcb.html">udp_pcb</a> *pcb)</td></tr>
<tr class="separator:ga8d26559743e59e4b409c92a268ee67fc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gada6d02b9a5f35e1fb2e1bc71b11e6027"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__udp__raw.html#gada6d02b9a5f35e1fb2e1bc71b11e6027">udp_recv</a> (struct <a class="el" href="structudp__pcb.html">udp_pcb</a> *pcb, <a class="el" href="udp_8h.html#af0ec7feb31acdb6e11b928f438c8a64b">udp_recv_fn</a> <a class="el" href="group__socket.html#gadd7ae45df7c005619eb1126542231e9b">recv</a>, void *recv_arg)</td></tr>
<tr class="separator:gada6d02b9a5f35e1fb2e1bc71b11e6027"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga3aed8e469f74f960837ebf9f34acf646"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__udp__raw.html#ga3aed8e469f74f960837ebf9f34acf646">udp_remove</a> (struct <a class="el" href="structudp__pcb.html">udp_pcb</a> *pcb)</td></tr>
<tr class="separator:ga3aed8e469f74f960837ebf9f34acf646"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa6d6430499acae43d342f0e68ddbb209"><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="structudp__pcb.html">udp_pcb</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__udp__raw.html#gaa6d6430499acae43d342f0e68ddbb209">udp_new</a> (void)</td></tr>
<tr class="separator:gaa6d6430499acae43d342f0e68ddbb209"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaf1ab236050dd351e93f112cfbc1ada88"><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="structudp__pcb.html">udp_pcb</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__udp__raw.html#gaf1ab236050dd351e93f112cfbc1ada88">udp_new_ip_type</a> (u8_t type)</td></tr>
<tr class="separator:gaf1ab236050dd351e93f112cfbc1ada88"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab857f86a0b15d02b864292b161b2c3fc"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="udp_8c.html#ab857f86a0b15d02b864292b161b2c3fc">udp_netif_ip_addr_changed</a> (const <a class="el" href="group__ipaddr.html#ga16ef96d6cde029029bbf47fee35fd67a">ip_addr_t</a> *old_addr, const <a class="el" href="group__ipaddr.html#ga16ef96d6cde029029bbf47fee35fd67a">ip_addr_t</a> *new_addr)</td></tr>
<tr class="separator:ab857f86a0b15d02b864292b161b2c3fc"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>User Datagram Protocol module<br />
The code for the User Datagram Protocol UDP &amp; UDPLite (RFC 3828).<br />
See also <a class="el" href="group__udp__raw.html">UDP</a> </p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="ae7f7431ce99333577d7b82b26619309e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae7f7431ce99333577d7b82b26619309e">&#9670;&nbsp;</a></span>udp_init()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void udp_init </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Initialize this module. </p>

</div>
</div>
<a id="a7b338a5515606bd51976fbc5bcec9611"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7b338a5515606bd51976fbc5bcec9611">&#9670;&nbsp;</a></span>udp_input()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void udp_input </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structpbuf.html">pbuf</a> *&#160;</td>
          <td class="paramname"><em>p</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">struct <a class="el" href="structnetif.html">netif</a> *&#160;</td>
          <td class="paramname"><em>inp</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Process an incoming UDP datagram.</p>
<p>Given an incoming UDP datagram (as a chain of pbufs) this function finds a corresponding UDP PCB and hands over the pbuf to the pcbs recv function. If no pcb is found or the datagram is incorrect, the pbuf is freed.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">p</td><td>pbuf to be demultiplexed to a UDP PCB (p-&gt;payload pointing to the UDP header) </td></tr>
    <tr><td class="paramname">inp</td><td>network interface on which the datagram was received. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ab857f86a0b15d02b864292b161b2c3fc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab857f86a0b15d02b864292b161b2c3fc">&#9670;&nbsp;</a></span>udp_netif_ip_addr_changed()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void udp_netif_ip_addr_changed </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="group__ipaddr.html#ga16ef96d6cde029029bbf47fee35fd67a">ip_addr_t</a> *&#160;</td>
          <td class="paramname"><em>old_addr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="group__ipaddr.html#ga16ef96d6cde029029bbf47fee35fd67a">ip_addr_t</a> *&#160;</td>
          <td class="paramname"><em>new_addr</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This function is called from <a class="el" href="netif_8c.html">netif.c</a> when address is changed</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">old_addr</td><td>IP address of the netif before change </td></tr>
    <tr><td class="paramname">new_addr</td><td>IP address of the netif after change </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_aebb8dcc11953d78e620bbef0b9e2183.html">core</a></li><li class="navelem"><a class="el" href="udp_8c.html">udp.c</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
  </ul>
</div>
</body>
</html>
